﻿using BuzzX8.Xmpp.StreamElements.Stanza;

namespace BuzzX8.Xmpp.StreamElements.Factories
{
    public class MessageStanzaFactory : StanzaFactory<MessageStanzaType, MessageStanza, MessageModel>
    {
        protected override MessageModel CreateModelByParameters(PropertyDictionary parameters)
        {
            return new MessageModel(parameters);
        }

        protected override MessageStanza CreateNewElement()
        {
            return new MessageStanza();
        }

        protected override void UpdateElementByModel(MessageStanza element, MessageModel model)
        {
            base.UpdateElementByModel(element, model);
            element.Subject = model.Subject;
            element.Body = model.Text;
            element.ThreadId = model.ThreadId;
            element.ParentThreadId = model.ParentThreadId;
        }
    }
}
